import useRequest from "../hooks/useRequest"
import { useEffect } from 'react'
import './my.css'
function My() {
    const { data, loading } = useRequest('http://10.2.35.4/api/nezha2.json', { imgs: [] })
    return <div className="container">
        {loading ? <div className="mask">正在加载中，请稍后</div> : <>
            <div className="top">
                <div className="avatar">
                    <img src={data.imgs[0]} alt="" />
                </div>
                <div className="info">
                    <div>{data.name}</div>
                    <div>{data.email}</div>
                    <div>{data.company}</div>
                </div>
            </div>
            <div className="bottom">
                <h3>作品：</h3>
                <div className="img-container">
                    {data.imgs.map((url, index) => {
                        return <img className="img" src={url} alt="" key={index} />
                    })}
                </div>
            </div>
        </>}


    </div>
}

export default My